package it.fantacalcio.test;

import java.util.List;

import it.fantacalcio.hibernate.sessionfactory.HibernateSessionFactory;
import it.fantacalcio.model.User;
import it.fantacalcio.spring.service.MyServiceFactory;

import org.hibernate.Transaction;

public class testDAO {
	public static void main(String[] args) {

		try {
			
			Transaction tx = HibernateSessionFactory.getSession().beginTransaction();
			
			System.out.println("findAll");
			List<User> list = MyServiceFactory.getUserService().list();
			for (User user : list) {
				System.out.println(user);
			}
			
			System.out.println("Presidente");
			List<User> listaPresidenti = MyServiceFactory.getUserService().listaPresidenti();
			for (User user : listaPresidenti) {
				System.out.println(user);
			}
			
			
			tx.commit();
		
		}catch (Exception e) {
			e.printStackTrace();
		}

	}

}
